from login import use_default_login
from collect import CollectThread
import utils


def collect_and_generate():
    library = utils.default_library()
    service = use_default_login()
    account_chunks = library.get_account_chunks(20)
    chunk_count = 1
    for chunk in account_chunks:
        pool = []
        for gh_id in chunk:
            account = library.get_account_data(gh_id)
            thread = CollectThread(service, account)
            thread.start()
            pool.append(thread)
        for thread in pool:
            thread.join()
        chunk_count += 1
    input('=运行结束，按回车键退出=')


if __name__ == '__main__':
    collect_and_generate()
